package com.oliver.oliveraiagent.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName user_credits
 */
@TableName(value ="user_credits")
@Data
public class UserCredits {
    /**
     * 额度记录ID
     */
    @TableId(type = IdType.AUTO)
    private Long creditId;

    /**
     * 关联用户ID
     */
    private Long userId;

    /**
     * 当前可用额度
     */
    private Integer availableCredit;

    /**
     * 总授予额度
     */
    private Integer totalCredit;

    /**
     * 
     */
    private Date lastUpdated;

    /**
     * 额度过期时间
     */
    private Date expiryDate;

    /**
     * 是否删除 0-未删除 1-已删除
     */
    private Integer isDelete;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserCredits other = (UserCredits) that;
        return (this.getCreditId() == null ? other.getCreditId() == null : this.getCreditId().equals(other.getCreditId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getAvailableCredit() == null ? other.getAvailableCredit() == null : this.getAvailableCredit().equals(other.getAvailableCredit()))
            && (this.getTotalCredit() == null ? other.getTotalCredit() == null : this.getTotalCredit().equals(other.getTotalCredit()))
            && (this.getLastUpdated() == null ? other.getLastUpdated() == null : this.getLastUpdated().equals(other.getLastUpdated()))
            && (this.getExpiryDate() == null ? other.getExpiryDate() == null : this.getExpiryDate().equals(other.getExpiryDate()))
            && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCreditId() == null) ? 0 : getCreditId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getAvailableCredit() == null) ? 0 : getAvailableCredit().hashCode());
        result = prime * result + ((getTotalCredit() == null) ? 0 : getTotalCredit().hashCode());
        result = prime * result + ((getLastUpdated() == null) ? 0 : getLastUpdated().hashCode());
        result = prime * result + ((getExpiryDate() == null) ? 0 : getExpiryDate().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", creditId=").append(creditId);
        sb.append(", userId=").append(userId);
        sb.append(", availableCredit=").append(availableCredit);
        sb.append(", totalCredit=").append(totalCredit);
        sb.append(", lastUpdated=").append(lastUpdated);
        sb.append(", expiryDate=").append(expiryDate);
        sb.append(", isDelete=").append(isDelete);
        sb.append("]");
        return sb.toString();
    }
}